package com.vinyl.font 
{
	import com.vinyl.font.FontLoader;
	import com.vinyl.font.FontProxy;
	
	/*
	import com.vinyl.events.DataEvent;
	import com.vinyl.font.FontProxy;
	import com.vinyl.font.FontService;
	
	var fontService = FontService.getInstance();
	fontInfo1 = fontService.getFont( "sharedFont.swf" );
	fontInfo1.addEventListener( com.vinyl.events.DataEvent.GETDATA, onComplete );
	fontInfo1.load();
	*/
	public class FontService
	{
		private static var instance:FontService;
		private var fontList:Object = {};
		
		public function FontService()
		{
			if(instance != null)
			{
				throw new Error("DataService Singleton already constructed!");
			}
		}
		
		public static function getInstance():FontService
		{
			if(instance == null)
			{
				instance=new FontService();
			}
			
			return instance;
		}
		
		public function getFont( url:String )
		{
			var fl:FontLoader = fontList[url] as FontLoader;
			if( !fl )
			{
				fl = new FontLoader( url );
				fontList[url] = fl;
			}
			return new FontProxy( fl );
		}
	}
}